//
//  YDHomeOptionsDynamicModel.m
//  siyanone
//
//  Created by LK-IOS on 2018/3/27.
//  Copyright © 2018年 LK-News. All rights reserved.
//

#import "YDHomeOptionsDynamicModel.h"

@implementation YDHomeOptionsDynamicModel


-(NSString *)pzProfitString
{
    if ([self.tradeType isEqualToString:@"1"]) {//买入，显示名义本金
        
        return [NSString stringWithFormat:@"名义本金%@" ,[self getFormateNominalMoney]];
    }else if ([self.tradeType isEqualToString:@"2"]){//卖出，计算盈利
        if ([[self getFormateProfitMoney] isEqualToString:@"---"]) {
            return @"---";
        }else{
            return [NSString stringWithFormat:@"盈利%@" , [self getFormateProfitMoney]];
        }
        
        
    }else{
        return @"---";
    }
    
}


-(NSString *)getFormateNominalMoney
{
    if ([self.nominalAmount integerValue] < 10000) {
        return [NSString stringWithFormat:@"%@元" , [NSString countNumAndChangeformat:self.nominalAmount]];
    }else{
        NSString *wanString = [self.nominalAmount pz_stringNumberByDividingBy:@"10000"];
        NSArray *array = [wanString componentsSeparatedByString:@"."];
        
        return [NSString stringWithFormat:@"%@万元" , array[0]];
    }
    
}
-(NSString *)getFormateProfitMoney
{
    if (self.profit.length && [self.profit integerValue] > 0) {
        
        if ([self.profit integerValue] < 10000) {
            return [NSString stringWithFormat:@"%@元" , [NSString countNumAndChangeformat:self.profit]];
        }else{
            
            NSString *wanString = [self.profit pz_stringNumberByDividingBy:@"10000"];
            
            return [NSString stringWithFormat:@"%@万元" , wanString];
        }
        
        
    }else{
        return @"---";
    }
    
}


@end
